<template>
    <el-dialog v-model="dialogTableVisible" title="直推信息" width="90%">
        <p>社区人数：{{ list.length }}</p>
        <el-table ref="multipleTable" :data="list" v-loading="loading">
            <el-table-column prop="Id" width="80" label="#"> </el-table-column>
            <el-table-column prop="Address" label="用户地址" width="200">
            </el-table-column>
            <el-table-column prop="Upline" label="上级地址" width="200">
            </el-table-column>
            <el-table-column prop="USDT" label="USDT" width="110"> </el-table-column>
            <el-table-column prop="USDH" label="USDH" width="110"> </el-table-column>
            <el-table-column prop="USDF" label="USDF" width="110"> </el-table-column>
            <el-table-column prop="HF" label="HF" width="110"> </el-table-column>
            <el-table-column prop="NFTV" label="贡献值" width="110"> </el-table-column>
            <el-table-column prop="TotalInvest1" label="当前预赛" width="110"> </el-table-column>
            <el-table-column prop="TotalInvest2" label="当前半决赛" width="110"> </el-table-column>
            <el-table-column prop="TotalInvest3" label="当前决赛" width="110"> </el-table-column>
            <el-table-column prop="TotalInvest4" label="当前总决赛" width="110"> </el-table-column>
            <el-table-column prop="DownlineInvest1" label="社区预赛" width="110">
            </el-table-column>
            <el-table-column prop="DownlineInvest2" label="社区半决赛" width="110">
            </el-table-column>
            <el-table-column prop="DownlineInvest3" label="社区决赛" width="110">
            </el-table-column>
            <el-table-column prop="DownlineInvest4" label="社区总决赛" width="110">
            </el-table-column>
            <el-table-column prop="Auto15" label="半决赛复利" width="110"></el-table-column>
            <el-table-column prop="Auto30" label="决赛复利" width="110"></el-table-column>
            <el-table-column prop="Auto90" label="总决赛复利" width="110"></el-table-column>
            <el-table-column prop="Status" label="权限" width="110">
                <template #default="scope">
                    {{ ['允许', '不允许', '自动'][scope.row.Status] }}
                </template>
            </el-table-column>
            <el-table-column prop="UserLevel" label="用户等级" width="110"></el-table-column>
            <el-table-column prop="Rate1" label="rate1" width="110"></el-table-column>
            <el-table-column prop="Rate2" label="rate2" width="110"></el-table-column>
            <el-table-column prop="Rate3" label="rate3" width="110"></el-table-column>
            <el-table-column prop="Rate4" label="rate4" width="110"></el-table-column>

            <el-table-column prop="DirectCount" label="有效直推" width="110"></el-table-column>
            <el-table-column prop="DownlineCount" label="社区成员" width="110">
            </el-table-column>
            <el-table-column prop="Workroom" label="工作室" width="110">
                <template #default="scope">
                    {{ ['不是', '是'][scope.row.Workroom] }}
                </template>
            </el-table-column>
            <el-table-column prop="Leader" label="领导人" width="110">
                <template #default="scope">
                    {{ ['不是领导人', '是领导人'][scope.row.Leader] }}
                </template>
            </el-table-column>
            <el-table-column prop="AdminId" label="所属团队" width="110">
            </el-table-column>
            <el-table-column prop="NodeOpen" label="节点开关" width="110">
                <template #default="scope">
                    {{ ['关闭', '打开'][scope.row.NodeOpen] }}
                </template>
            </el-table-column>
            <el-table-column prop="TransOpen" label="转账白名单" width="110">
                <template #default="scope">
                    {{ ['关闭', '打开'][scope.row.NodeOpen] }}
                </template>
            </el-table-column>
            <el-table-column prop="SendAmount" label="每日提币数量" width="110">
            </el-table-column>
            <el-table-column prop="SendCount" label="每日提币次数" width="110">
            </el-table-column>
            <el-table-column prop="CreatedAt" label="注册时间" min-width="160">
            </el-table-column>
        </el-table>
        <div class="right">
            <el-pagination background layout="total, sizes, prev, pager, next, jumper" :page-size="formData.pageSize" :total="formData.total" @size-change="handleSizeChange" @current-change="handleCurrentChange">
            </el-pagination>
        </div>
    </el-dialog>
</template>
<script setup>
import { reactive, ref, defineExpose } from "vue";
import { getDirectList } from "@/api";
const dialogTableVisible = ref(false);
const formData = reactive({
    pageNum: 0,
    pageSize: 10,
    total: 0,
    address: "",
});
const loading = ref(false);
const list = ref([]);
const onSubmit = async () => {
    loading.value = true;
    try {
        const res = await getDirectList(formData);
        console.log(res);
        list.value = res.data.data.DirectList;
        formData.total = res.data.data.Total;
        SumUSDT.value = res.data.data.SumUSDT;
    } catch (error) {}
    loading.value = false;
};
const handleSizeChange = (val) => {
    formData.pageSize = val;
    formData.pageNum = 0;
    onSubmit();
};
const handleCurrentChange = (val) => {
    formData.pageNum = val - 1;
    onSubmit();
};

const show = (item) => {
    dialogTableVisible.value = true;
    formData.address = item.Address;
    onSubmit();
};
defineExpose({
    show,
});
</script>
<style lang="scss" scoped>
.right {
    overflow: auto;
}

.el-pagination {
    padding: 15px;
    float: right;
}
</style>